package com.qiangesoft.pay.controller;

import com.qiangesoft.pay.service.PayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;

/**
 * 微信支付
 *
 * @author qiangesoft
 * @date 2024-02-23
 */
@RestController
@RequestMapping("/wxpay")
public class WxPayController {

    @Autowired
    private PayService wxpayServiceImpl;

    @GetMapping("/pay")
    public String pay(@RequestParam BigDecimal amount) {
        return wxpayServiceImpl.pay("1234567890", "模拟支付", amount);
    }

    @PostMapping("/notify")
    public String notify(HttpServletRequest request) {
        return wxpayServiceImpl.notify(request);
    }
}
